<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>考试记录</title>
<link rel="stylesheet" href="../static/layui/css/layui.css">
</head>
<body>
	<h1>考试记录</h1>
	
	<!-- 按钮区 -->
	<div class="site-demo-button" id="layerDemo" style="margin-bottom: 0;">
	  <button class="layui-btn">创建考试</button>
	  <button class="layui-btn">考试管理</button>
	</div></br>
	
	<br>
 		<table border="1" bordercolor="#a0c6e5" style="margin-left:10px">
 			<tr><td>考试名称:</td><td>${record.record_name }</td></tr>
 			<tr><td>考试时间：</td><td>${record.record_start}至${record.record_end}</td></tr>
 			<tr><td>及格分数：</td><td>${record.record_score}</td></tr>
 			<tr><td>试卷总分：</td><td>${zongfen}</td></tr>
 		</table>
   <br>
   <!-- 主体内容区 -->
   <hr/>
   <table class="layui-table" style="margin-left:10px">
	  <colgroup>
	    <col width="100">
	  </colgroup>
	 <thead>
	     <tr>
	        <th><input type="checkbox"/></th>
	        <th>姓名</th><th>班级</th><th>得分</th><th>操作</th>
	     </tr>
     </thead>
     <tbody>
     <c:forEach items="${userRecordlist}" var="use">
       <tr>
       <td><input type='checkbox' name='st' /></td>
       <td>${use.user_name}</td><td><a href="grade_record.jsp?classid=${use.class_id}&recordid=${use.record_id}">${use.class_name}</a></td><td>${use.user_score}</td>
       <td>
        <button type="button" class="layui-btn layui-btn-normal btndel1" dataid=''>查看试卷</button>
    	<button type="button" class="layui-btn layui-btn-danger btndel2" dataid='${use.user_id}'>删除</button>
       </td>
       </tr>
     </c:forEach>
     </tbody>
   </table>
   <!-- 分页 -->
   <!-- <div id="demo3"></div> -->
   <div class="fen">
      <c:forEach begin="${pb.beginNum }" end="${pb.endNum }" varStatus="k">
	      <c:if test="${k.index == pb.curPage }">
	         <a class="fenye" style='background:red' href='exam_record?m=find&p=${k.index}'>${k.index}</a>
	      </c:if>
	      <c:if test="${k.index != pb.curPage}">
	         <a class="fenye" href='exam_record?m=find&p=${k.index}'>${k.index}</a>
	      </c:if>
      </c:forEach> 
   </div>
</body>
<script type="text/javascript" src="../static/js/jquery.min.js"></script>
<script type="text/javascript" src="../static/layui/layui.js"></script>
<script type="text/javascript">
//删除考试
layui.use('layer', function(){ //独立版的layer无需执行这一句
	  var $ = layui.jquery, layer = layui.layer;
	  			 
	//所有删除BTN  加事件
	$(".btndel2").click(function(){
		var id = $(this).attr("dataid");
		layer.confirm('您确定要删除该考生吗?',{btn: ['确定', '取消'],title:"提示"},function(index){
            console.log("del ok " + id);  
            location.href="http://localhost:8080/OnlineExam1/admin/exam_record?m=del1&id="+id;
            layer.close(index);
		});
	});
});
//按钮切换
$(function(){
    $("button:eq(0)").click(function(){
    	window.location.href='http://localhost:8080/OnlineExam1/admin/exam_record?m=addExam'
    });

    $("button:eq(1)").click(function(){
    	window.location.href='http://localhost:8080/OnlineExam1/admin/exam_record?m=page'
    }); 
});
</script>
</html>